/*
day273
2020.5.27
*/
#include<stack>
#include<sstream>
#include<string>
#include<cstdlib>
using namespace std;

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Codec {
public:
    // Encodes a tree to a single string.
    string serialize(TreeNode* root) {
    	string res="";
        stringstream str(res);
        help_serialize(root,str);
        return res;
    }
    
    void help_serialize(TreeNode* root,stringstream &str)
    {
    	if(!root)
    	{
    		str<<"null";
    		return;
		}
		
		help_serialize(root->left,str);
		help_serialize(root->right,str);
	}

    // Decodes your encoded data to tree.
    TreeNode* deserialize(string data) {
    	stringstream str(data);
        return help_deserialize(str);
    }
    
    TreeNode* help_deserialize(stringstream &str){
    	string tem;
    	str>>tem;
    	if(tem=="null")
    	{
    		return nullptr;
		}
		
		
		int val=stoi(tem);
		
		TreeNode *root=new TreeNode(val);
		
		root->left=help_deserialize(str);
		root->right=help_deserialize(str);
		
		return root;
	} 
    
};



int main()
{
	return 0;
}
